<?php 
$numResults = count($this->negocios);
?>
<div id="listing" >
	<h1 class="title"><?php echo $numResults ? $this->translate('commercesFound') : $this->translate('searchResult')?></h1>
	<?php 
	$messages = $this->MyFlashMessenger();
	
	echo $messages;
	
	if ( $numResults ) {
		
		echo $this->render('negocios/negocio.phtml');
		
	} elseif( isset( $this->direccionesEncontradas ) ) {
		
		echo $this->message()->warning($this->translate('manyAddressesMatch'));
		
		?>
		<form id="searchManyAddresses" action ="/negocios/buscar" method="POST">
			<input type="hidden" name="what" value="<?php echo $this->defaultWhat?>"/>
			<ul>
		<?php
		
		foreach( $this->direccionesEncontradas as $direccion){
			
			echo "<li><input type='radio' name='where' value='{$direccion}' id='dir{$direccion->getId()}'/><label for='dir{$direccion->getId()}'>$direccion</label></li>";
			
		}
		?>
		</ul>
		<?php echo $this->button( $this->translate('search'), null, null, false )?>
		</form>
		<?php
		 
		$this->jQuery()->onLoadCaptureStart();?>

		$("#searchManyAddresses .button").click(function(){
		
			var $form = $(this).parent();
		
			$form.submit();
		    return false;
		});	
		
		<?php	
		$this->jQuery()->onLoadCaptureEnd();
		
		
		
	} elseif( ! $messages ) {
		
		echo $this->message()->warning($this->translate('commercesNotFound'));
		
		?>
		<p class="noResults">¡No te desanimes! trabajamos día a día para agregar nuevos negocios a nuestro portal, registrate y enterate cada mes de los nuevos negocios adheridos a través de nuestra newsletter.</p>
		<?php 
	}
	?>

</div>
<?php 
$this->renderToPlaceholder('side/ciudades.phtml', 'side');
$this->renderToPlaceholder('side/cocinas.phtml', 'side');

$this->headTitle()->append( $this->translate('meta-title-search') );
